package com.rd.student.ruanjian.class1.duhang.Week04.New01;

public class Test01 extends Thread{
    public static void main(String[] args) {

        Thread thread01 = new Thread(new Runnable() {
            @Override
            public synchronized void run() {
                //数字
                for (int i = 1; i <= 52; i++) {
                    System.out.print(i);
                    if (i % 2 == 0){
                        notify();
                        try {
                            wait();
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
        });

        Thread thread02 = new Thread(new Runnable() {
            @Override
            public synchronized void run() {
                //字母
                for (char i = 'A'; i <= 'Z'; i++) {
                    System.out.print(i);
                    notify();
                    try {
                        this.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });

        thread01.start();
        thread02.start();
    }

}
